package com.atguigu.admin.exception;

/**
 * @author 杨林
 * @create 2023-08-30 16:05 星期三
 * description:
 */

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * 处理整个web controller的异常
 */
@ControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    
    @ExceptionHandler({ArithmeticException.class,NullPointerException.class})   //处理异常
    public String handleMathException(Exception e){
        
        log.info("异常是：{}",e);
        return "login";    //视图地址
    }
    
}
